package FileIOStream;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

/**
 * @Author liangzai
 * @Description:
 */
public class Demo4 {
    public static void main(String[] args) {
        File file = new File("./test.txt");
        try(FileInputStream inputStream = new FileInputStream(file)){
            while(true) {
                byte[] bite = new byte[3];
                int n = inputStream.read(bite);
                if (n == -1) {
                    break;
                }
                for (int i = 0; i < n; i++) {
                    System.out.printf("0x%x\n",bite[i]);
                }
                System.out.println("==================");
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
